package com.herui.ota.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.LinkedList;
import java.util.List;

@Data
public class BaseTree {

    @TableId(
            type = IdType.AUTO
    )
    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty("主键id")
    private Integer id;

    private Integer parentId;

    private String nodeData;

    private Integer level;

    @TableField(exist = false)
    private List<BaseTree> baseTrees = new LinkedList<>();

    public BaseTree(Integer id, Integer parentId, String nodeData, Integer level) {
        this.id = id;
        this.parentId = parentId;
        this.nodeData = nodeData;
        this.level = level;
    }

    public BaseTree() {
    }

    @Override
    public String toString() {
        return "BaseTree{" +
                "id=" + id +
                ", parentId=" + parentId +
                ", nodeData='" + nodeData + '\'' +
                ", level=" + level +
                ", baseTrees=" + baseTrees +
                '}';
    }
}
